package com.thinkgem.jeesite.modules.website;

import com.thinkgem.jeesite.modules.area_info.entity.AreaInfo;
import com.thinkgem.jeesite.modules.area_info.service.AreaInfoService;
import com.thinkgem.jeesite.modules.area_info_his.entity.AreaInfoHis;
import com.thinkgem.jeesite.modules.lane.entity.Lane;
import com.thinkgem.jeesite.modules.lane.service.LaneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @author xlp
 * @date 2019/5/23
 * 数据推送给黑蚂蚁
 */
@RestController
@RequestMapping("/dataPush")
public class DataPushController {

    @Autowired
    private LaneService laneService;

    @Autowired
    private AreaInfoService areaInfoService;

    @RequestMapping(value = "/getAreaCarInfo", method = RequestMethod.POST)
    public List<AreaInfoHis> getGuide(HttpServletRequest request, String id) {
        AreaInfo areaInfo = new AreaInfo();
        List<AreaInfo> areaInfoList = areaInfoService.findList(areaInfo);
        if (CollectionUtils.isEmpty(areaInfoList)){
            return null;
        }
        List<AreaInfoHis> hisList = new ArrayList<AreaInfoHis>();
        AreaInfoHis his = new AreaInfoHis();
        for (AreaInfo areaInfo1:areaInfoList){
            his.setAreaName(areaInfo1.getAreaName());
            Lane lane = new Lane();
            lane.setAreaId(areaInfo1.getId());

        }
        return hisList;
    }

}
